#FILE NAME: 6711Sources16mm_TG43_5.txt
#MC CODE: TOPAS V3.8 
#DESCRIPTION: Test case 2 – Single 6711 seed at position 6 (equivalent to position 6 in 16 mm COMS eye plaque) in water phantom; see [reference]
#DISCLAIMER: This file (and associated code/files) is provided in the hope that it will be useful
#but without any warranty; without even the implied warranty of fitness for a particular
#purpose. See full disclaimer at [link]
#COPYRIGHT (C) 2023 Luc Beaulieu (Luc.Beaulieu@phy.ulaval.ca) and Audran Poher
#REDISTRIBUTION: redistribution of this and all associated files is NOT permitted.
#SOURCE OF THIS FILE: [link]

b:Ma/MyWater/BuildFromMaterials = "True"
sv:Ma/MyWater/Components = 1 "G4_WATER"
uv:Ma/MyWater/Fractions = 1 1
d:Ma/MyWater/Density = 0.998 g/cm3    

##### WORLD #####
d:Ge/World/HLX = 15 cm
d:Ge/World/HLY = 15 cm
d:Ge/World/HLZ = 15 cm
s:Ge/World/Material = "MyWater"

# ====================================================== #
#                         PHYSICS                        #
# ====================================================== #

sv:Ph/Default/Modules                  = 1 "g4em-standard_opt4"
d:Ph/Default/CutForElectron            = 1 mm
b:Ph/Default/Auger                     = "T"
b:Ph/Default/AugerCascade              = "T"
b:Ph/Default/Fluorescence              = "T"
b:Ph/Default/DeexcitationIgnoreCut     = "T"
b:Ph/Default/PIXE                      = "T"  
    
i:Ts/Seed            = 1
i:Ts/NumberOfThreads = 0


# ====================================================== #
#                         SCORER                         #
# ====================================================== #

##### RADIAL FUNCTION SCORER #####
s:Ge/RTDoseGrid/Type       = "TsBox"
s:Ge/RTDoseGrid/Parent     = "World"
d:Ge/RTDoseGrid/HLX        =  12.75 mm
d:Ge/RTDoseGrid/HLY        =  12.75 mm
d:Ge/RTDoseGrid/HLZ        =  12.75 mm
d:Ge/RTDoseGrid/TransX     =  0 mm
d:Ge/RTDoseGrid/TransY     =  0 mm
d:Ge/RTDoseGrid/TransZ     =  12 mm
s:Ge/RTDoseGrid/Color      =  "red"
b:Ge/RTDoseGrid/IsParallel = "T"
i:Ge/RTDoseGrid/XBins      = 51
i:Ge/RTDoseGrid/YBins      = 51
i:Ge/RTDoseGrid/ZBins      = 51

#d:Sc/ScorerCyl/OnlyIncludeParticlesWithInitialKEAbove = 5. keV
s:Sc/ScorerCyl/Quantity   = "TrackLengthEstimator"
s:Sc/ScorerCyl/InputFile  = "Muen.dat"

#s:Sc/ScorerCyl/Quantity   = "DoseToMedium"
sv:Sc/ScorerCyl/Report    = 1 "Sum" 
s:Sc/ScorerCyl/Component  = "RTDoseGrid"
s:Sc/ScorerCyl/OutputFile = "6711_SeedsTG43_DoseDistribution_0"
s:Sc/ScorerCyl/OutputType                 = "DICOM"
b:Sc/ScorerCyl/DICOMOutput32BitsPerPixel  = "True"
s:Sc/ScorerCyl/IfOutputFileAlreadyExists = "Increment"
sv:Sc/ScorerCyl/OnlyIncludeParticlesNamed = 1 "gamma"
sv:Sc/ScorerCyl/OnlyIncludeIfInMaterial = 1 "MyWater"
#sv:Sc/ScorerCyl/OnlyIncludeIfNotInMaterial = 4 "MatRadioMatrix" "G4_Ag" "Titanium" "G4_AIR" 

#d:Sc/ScorerCyl1/OnlyIncludeParticlesWithInitialKEAbove = 5. keV
s:Sc/ScorerCyl1/Quantity   = "TrackLengthEstimator"
s:Sc/ScorerCyl1/InputFile  = "Muen.dat"

#s:Sc/ScorerCyl1/Quantity   = "DoseToMedium"
sv:Sc/ScorerCyl1/Report    = 1 "Standard_Deviation" 
s:Sc/ScorerCyl1/Component  = "RTDoseGrid"
s:Sc/ScorerCyl1/OutputFile = "6711_SeedsTG43_Std_DoseDistribution_0"
s:Sc/ScorerCyl1/OutputType = "csv"
s:Sc/ScorerCyl1/IfOutputFileAlreadyExists = "Increment"
sv:Sc/ScorerCyl1/OnlyIncludeParticlesNamed = 1 "gamma"
sv:Sc/ScorerCyl1/OnlyIncludeIfInMaterial = 1 "MyWater"


# ====================================================== #
#                         VIEWER                         #
# ====================================================== #

#Ge/QuitIfOverlapDetected     = "F"
s:Gr/ViewA/Type              = "OpenGL"
#i:Gr/ViewA/WindowSizeX      = 1024
#i:Gr/ViewA/WindowSizeY      = 768
d:Gr/ViewA/Theta             = 90. deg
d:Gr/ViewA/Phi               = 0. deg
#s:Gr/ViewA/Projection       = "Perspective"
#d:Gr/ViewA/PerspectiveAngle = 30. deg
u:Gr/ViewA/Zoom              = 1
b:Gr/MyGraphic1/IncludeAxes = "True" # defaults to "False"
s:Gr/ViewA/CenterOn = "World"
b:Ts/UseQt = "F"
b:Gr/Enable           = "F"
b:Ts/PauseBeforeQuit  = "F"

# ====================================================== #
#                I 125 - OncoSeed 6711                   #
# ====================================================== #
##### MATERIALS ######
sv:Ma/MatRadioMatrix/Components = 3 "Silver" "Iodine" "Bromine"
uv:Ma/MatRadioMatrix/Fractions = 3 0.5416 0.30396 0.15444
d:Ma/MatRadioMatrix/Density    = 6.2 g/cm3
#b:Ma/MatRadioMatrix/BuildFromMaterials = "T"
#sv:Ma/MatRadioMatrix/Components = 1 "G4_WATER"
#uv:Ma/MatRadioMatrix/Fractions = 1 1
#d:Ma/MatRadioMatrix/Density    = 0.998 g/cm3

s:Ge/GroupOfSeeds/Type              = "Group"
s:Ge/GroupOfSeeds/Parent            = "World"
#b:Ge/GroupOfSeeds/IsParallel        = "True"
#s:Ge/GroupOfSeeds/ParallelWorldName = "SeedsWorld"
d:Ge/GroupOfSeeds/TransX            = 0 mm
d:Ge/GroupOfSeeds/TransY            = 0 mm
d:Ge/GroupOfSeeds/TransZ            = -11 mm

sv:Ph/Default/LayeredMassGeometryWorlds = 2 "ShieldingWorld" "ActiveSourceWorld"



ic:So/ActiveSource5/NumberOfHistoriesInRun    = 5000000000   

s:Ge/Seed5/Type              = "Group"
s:Ge/Seed5/Parent            = "GroupOfSeeds"
#b:Ge/Seed5/IsParallel        = "True"
#s:Ge/Seed5/ParallelWorldName = "SeedsWorld"
d:Ge/Seed5/TransX            = -1.4 mm
d:Ge/Seed5/TransY            = 6.14 mm
d:Ge/Seed5/TransZ            = -0.87 mm
d:Ge/Seed5/RotX              = 90 deg
d:Ge/Seed5/RotY              = 103 deg
d:Ge/Seed5/RotZ              = 0 deg

##### SOURCE GEOMETRY #####

s:Ge/ActiveSourceGeometry5/Type              = "Group"
s:Ge/ActiveSourceGeometry5/Parent            = "Seed5"
b:Ge/ActiveSourceGeometry5/IsParallel        = "True"
s:Ge/ActiveSourceGeometry5/ParallelWorldName = "ActiveSourceWorld"

##### SOURCE #####
s:So/ActiveSource5/Type                       = "Volumetric"
s:So/ActiveSource5/Component                 = "ActiveSourceGeometry5"
sc:So/ActiveSource5/ActiveMaterial            = "MatRadioMatrix"
s:So/ActiveSource5/BeamParticle               = "gamma"
b:So/ActiveSource5/RecursivelyIncludeChildren = "T"
i:So:ActiveSource5/MaxNumberOfPointsToSample = 1000000000
s:So/ActiveSource5/BeamEnergySpectrumType     = "Discrete"

###### SPECTRUM ######
dv:So/ActiveSource5/BeamEnergySpectrumValues = 6 27.202 27.472 30.944 30.995 31.704 35.4925 keV
uv:So/ActiveSource5/BeamEnergySpectrumWeightsUnscaled = 6 0.396 0.731 0.0674 0.130 0.0375 0.0668
uv:So/ActiveSource5/BeamEnergySpectrumWeights = 0.699937006 * So/ActiveSource5/BeamEnergySpectrumWeightsUnscaled

#====================
#Radioactive cylinder
#====================

s:Ge/RadioactiveCylinder5/Type         = "TsCylinder"
s:Ge/RadioactiveCylinder5/Parent       = "ActiveSourceGeometry5"
s:Ge/RadioactiveCylinder5/Material     = "MatRadioMatrix"
d:Ge/RadioactiveCylinder5/RMin         = 0.25 mm
d:Ge/RadioactiveCylinder5/RMax         = 0.25175 mm
d:Ge/RadioactiveCylinder5/SPhi         = 0. deg
d:Ge/RadioactiveCylinder5/DPhi         = 360. deg
d:Ge/RadioactiveCylinder5/HL           = 1.325 mm
d:Ge/RadioactiveCylinder5/TransX       = 0. mm
d:Ge/RadioactiveCylinder5/TransY       = 0. mm
d:Ge/RadioactiveCylinder5/TransZ       = 0. mm
d:Ge/RadioactiveCylinder5/RotX         = 0. deg
d:Ge/RadioactiveCylinder5/RotY         = 0. deg
d:Ge/RadioactiveCylinder5/RotZ         = 0. deg
s:Ge/RadioactiveCylinder5/DrawingStyle = "FullWireFrame"
s:Ge/RadioactiveCylinder5/Color        = "yellow"
b:Ge/RadioactiveCylinder5/IsParallel   = "T"
s:Ge/RadioactiveCylinder5/ParallelWorldName = "ActiveSourceWorld"

#=====================
#Radioactive left end
#=====================
s:Ge/RadioactiveLeftEnd5/Type                   = "G4Cons"
s:Ge/RadioactiveLeftEnd5/Parent                 = "ActiveSourceGeometry5"
s:Ge/RadioactiveLeftEnd5/Material               = "MatRadioMatrix"
d:Ge/RadioactiveLeftEnd5/TransX                 = 0 mm
d:Ge/RadioactiveLeftEnd5/TransY                 = 0 mm
d:Ge/RadioactiveLeftEnd5/TransZ                 = 1.363375 mm
d:Ge/RadioactiveLeftEnd5/RotX                   = 0 deg
d:Ge/RadioactiveLeftEnd5/RotY                   = 0 deg
d:Ge/RadioactiveLeftEnd5/RotZ                   = 0 deg
d:Ge/RadioactiveLeftEnd5/RMin1                  = 0. mm
d:Ge/RadioactiveLeftEnd5/RMax1                  = 0.25175 mm
d:Ge/RadioactiveLeftEnd5/RMin2                  = 0. mm
d:Ge/RadioactiveLeftEnd5/RMax2                  = 0.17675 mm
d:Ge/RadioactiveLeftEnd5/HL                     = 0.038375 mm
d:Ge/RadioactiveLeftEnd5/SPhi                   = 0 deg
d:Ge/RadioactiveLeftEnd5/DPhi                   = 360 deg
s:Ge/RadioactiveLeftEnd5/Color                  = "yellow"
s:Ge/RadioactiveLeftEnd5/DrawingStyle           = "FullWireFrame"
b:Ge/RadioactiveLeftEnd5/IsParallel             = "T"
s:Ge/RadioactiveLeftEnd5/ParallelWorldName      = "ActiveSourceWorld"

#=====================
#Radioactive right end
#=====================
s:Ge/RadioactiveRightEnd5/Type                   = "G4Cons"
s:Ge/RadioactiveRightEnd5/Parent                 = "ActiveSourceGeometry5"
s:Ge/RadioactiveRightEnd5/Material               = "MatRadioMatrix"
d:Ge/RadioactiveRightEnd5/TransX                 = 0 mm
d:Ge/RadioactiveRightEnd5/TransY                 = 0 mm
d:Ge/RadioactiveRightEnd5/TransZ                 = -1.363375 mm
d:Ge/RadioactiveRightEnd5/RotX                   = 0 deg
d:Ge/RadioactiveRightEnd5/RotY                   = 180 deg
d:Ge/RadioactiveRightEnd5/RotZ                   = 0 deg
d:Ge/RadioactiveRightEnd5/RMin1                  = 0. mm
d:Ge/RadioactiveRightEnd5/RMax1                  = 0.25175 mm
d:Ge/RadioactiveRightEnd5/RMin2                  = 0. mm
d:Ge/RadioactiveRightEnd5/RMax2                  = 0.17675 mm
d:Ge/RadioactiveRightEnd5/HL                     = 0.038375 mm
d:Ge/RadioactiveRightEnd5/SPhi                   = 0 deg
d:Ge/RadioactiveRightEnd5/DPhi                   = 360 deg
s:Ge/RadioactiveRightEnd5/Color                  = "yellow"
s:Ge/RadioactiveRightEnd5/DrawingStyle           = "FullWireFrame"
b:Ge/RadioactiveRightEnd5/IsParallel             = "T"
s:Ge/RadioactiveRightEnd5/ParallelWorldName      = "ActiveSourceWorld"

#====================
#Silver cylinder
#====================

s:Ge/SilverCylinder5/Type         = "TsCylinder"
s:Ge/SilverCylinder5/Parent       = "ActiveSourceGeometry5"
s:Ge/SilverCylinder5/Material     = "G4_Ag"
d:Ge/SilverCylinder5/RMin         = 0. mm
d:Ge/SilverCylinder5/RMax         = 0.25 mm
d:Ge/SilverCylinder5/SPhi         = 0. deg
d:Ge/SilverCylinder5/DPhi         = 360. deg
d:Ge/SilverCylinder5/HL           = 1.325 mm
d:Ge/SilverCylinder5/TransX       = 0. mm
d:Ge/SilverCylinder5/TransY       = 0. mm
d:Ge/SilverCylinder5/TransZ       = 0. mm
d:Ge/SilverCylinder5/RotX         = 0. deg
d:Ge/SilverCylinder5/RotY         = 0. deg
d:Ge/SilverCylinder5/RotZ         = 0. deg
s:Ge/SilverCylinder5/DrawingStyle = "FullWireFrame"
s:Ge/SilverCylinder5/Color        = "grey"
b:Ge/SilverCylinder5/IsParallel   = "T"
s:Ge/SilverCylinder5/ParallelWorldName = "ActiveSourceWorld"

#=================
#Silver left end
#=================

s:Ge/SilverLeftEnd5/Type                   = "G4Cons"
s:Ge/SilverLeftEnd5/Parent                 = "RadioactiveLeftEnd5"
s:Ge/SilverLeftEnd5/Material               = "G4_Ag"
d:Ge/SilverLeftEnd5/TransX                 = 0 mm
d:Ge/SilverLeftEnd5/TransY                 = 0 mm
d:Ge/SilverLeftEnd5/TransZ                 = -0.000875 mm
d:Ge/SilverLeftEnd5/RotX                   = 0 deg
d:Ge/SilverLeftEnd5/RotY                   = 0 deg
d:Ge/SilverLeftEnd5/RotZ                   = 0 deg
d:Ge/SilverLeftEnd5/RMin1                  = 0 mm
d:Ge/SilverLeftEnd5/RMax1                  = 0.25 mm
d:Ge/SilverLeftEnd5/RMin2                  = 0 mm
d:Ge/SilverLeftEnd5/RMax2                  = 0.175 mm
d:Ge/SilverLeftEnd5/HL                     = 0.0375 mm
d:Ge/SilverLeftEnd5/SPhi                   = 0 deg
d:Ge/SilverLeftEnd5/DPhi                   = 360 deg
s:Ge/SilverLeftEnd5/Color                  = "grey"
s:Ge/SilverLeftEnd5/DrawingStyle           = "FullWireFrame"
b:Ge/SilverLeftEnd5/IsParallel             = "T"
s:Ge/SilverLeftEnd5/ParallelWorldName      = "ActiveSourceWorld"

#=================
#Silver right end
#=================

s:Ge/SilverRightEnd5/Type                   = "G4Cons"
s:Ge/SilverRightEnd5/Parent                 = "RadioactiveRightEnd5"
s:Ge/SilverRightEnd5/Material               = "G4_Ag"
d:Ge/SilverRightEnd5/TransX                 = 0 mm
d:Ge/SilverRightEnd5/TransY                 = 0 mm
d:Ge/SilverRightEnd5/TransZ                 = -0.000875 mm
d:Ge/SilverRightEnd5/RotX                   = 0 deg
d:Ge/SilverRightEnd5/RotY                   = 0 deg
d:Ge/SilverRightEnd5/RotZ                   = 0 deg
d:Ge/SilverRightEnd5/RMin1                  = 0 mm
d:Ge/SilverRightEnd5/RMax1                  = 0.25 mm
d:Ge/SilverRightEnd5/RMin2                  = 0 mm
d:Ge/SilverRightEnd5/RMax2                  = 0.175 mm
d:Ge/SilverRightEnd5/HL                     = 0.0375 mm
d:Ge/SilverRightEnd5/SPhi                   = 0 deg
d:Ge/SilverRightEnd5/DPhi                   = 360 deg
s:Ge/SilverRightEnd5/Color                  = "grey"
s:Ge/SilverRightEnd5/DrawingStyle           = "FullWireFrame"
b:Ge/SilverRightEnd5/IsParallel             = "T"
s:Ge/SilverRightEnd5/ParallelWorldName      = "ActiveSourceWorld"

##### SHIELDING #####

s:Ge/ShieldingGeo5/Type              = "Group"
s:Ge/ShieldingGeo5/Parent            = "Seed5"
b:Ge/ShieldingGeo5/IsParallel        = "True"
s:Ge/ShieldingGeo5/ParallelWorldName = "ShieldingWorld"


#=====================
#Cylinder of Titanium
#=====================

s:Ge/TitaniumCylinder5/Type         = "TsCylinder"
s:Ge/TitaniumCylinder5/Parent       = "ShieldingGeo5"
s:Ge/TitaniumCylinder5/Material     = "G4_Ti"
d:Ge/TitaniumCylinder5/RMin         = 0.33 mm
d:Ge/TitaniumCylinder5/RMax         = 0.40 mm
d:Ge/TitaniumCylinder5/SPhi         = 180. deg
d:Ge/TitaniumCylinder5/DPhi         = 360. deg
d:Ge/TitaniumCylinder5/HL           = 1.875 mm
d:Ge/TitaniumCylinder5/TransX       = 0. mm
d:Ge/TitaniumCylinder5/TransY       = 0. mm
d:Ge/TitaniumCylinder5/TransZ       = 0. mm
d:Ge/TitaniumCylinder5/RotX         = 0. deg
d:Ge/TitaniumCylinder5/RotY         = 0. deg
d:Ge/TitaniumCylinder5/RotZ         = 0. deg
s:Ge/TitaniumCylinder5/Color        = "blue"
s:Ge/TitaniumCylinder5/DrawingStyle = "FullWireFrame"
b:Ge/TitaniumCylinder5/IsParallel   = "T"
s:Ge/TitaniumCylinder5/ParallelWorldName = "ShieldingWorld"

#===============================
#Left half-sphere of Titanium 
#===============================

s:Ge/TitaniumLeftCap5/Type         = "TsSphere"
s:Ge/TitaniumLeftCap5/Parent       = "ShieldingGeo5"
s:Ge/TitaniumLeftCap5/Material     = "G4_Ti"
d:Ge/TitaniumLeftCap5/RMin         = 0. mm
d:Ge/TitaniumLeftCap5/RMax         = 0.4 mm
d:Ge/TitaniumLeftCap5/SPhi         = 0. deg
d:Ge/TitaniumLeftCap5/DPhi         = 360. deg
d:Ge/TitaniumLeftCap5/STheta       = 0. deg
d:Ge/TitaniumLeftCap5/DTheta       = 90. deg
d:Ge/TitaniumLeftCap5/TransX       = 0. mm
d:Ge/TitaniumLeftCap5/TransY       = 0. mm
d:Ge/TitaniumLeftCap5/TransZ       = 1.875 mm
d:Ge/TitaniumLeftCap5/RotX         = 0. deg
d:Ge/TitaniumLeftCap5/RotY         = 0. deg
d:Ge/TitaniumLeftCap5/RotZ         = 0. deg
s:Ge/TitaniumLeftCap5/DrawingStyle = "FullWireFrame"
s:Ge/TitaniumLeftCap5/Color        = "blue"
b:Ge/TitaniumLeftCap5/IsParallel   = "T"
s:Ge/TitaniumLeftCap5/ParallelWorldName = "ShieldingWorld"

#================================
#Right half-sphere of titanium
#================================

s:Ge/TitaniumRightCap5/Type         = "TsSphere"
s:Ge/TitaniumRightCap5/Parent       = "ShieldingGeo5"
s:Ge/TitaniumRightCap5/Material     = "G4_Ti"
d:Ge/TitaniumRightCap5/RMin         = 0. mm
d:Ge/TitaniumRightCap5/RMax         = 0.4 mm
d:Ge/TitaniumRightCap5/SPhi         = 0. deg
d:Ge/TitaniumRightCap5/DPhi         = 360. deg
d:Ge/TitaniumRightCap5/STheta       = 0. deg
d:Ge/TitaniumRightCap5/DTheta       = 90. deg
d:Ge/TitaniumRightCap5/TransX       = 0. mm
d:Ge/TitaniumRightCap5/TransY       = 0. mm
d:Ge/TitaniumRightCap5/TransZ       = -1.875 mm
d:Ge/TitaniumRightCap5/RotX         = 180. deg
d:Ge/TitaniumRightCap5/RotY         = 0. deg
d:Ge/TitaniumRightCap5/RotZ         = 0. deg
s:Ge/TitaniumRightCap5/DrawingStyle = "FullWireFrame"
s:Ge/TitaniumRightCap5/Color        = "blue"
b:Ge/TitaniumRightCap5/IsParallel   = "T"
s:Ge/TitaniumRightCap5/ParallelWorldName = "ShieldingWorld"

#====================
#Dry Air cylinder
#====================

s:Ge/DryAirCylinder5/Type         = "TsCylinder"
s:Ge/DryAirCylinder5/Parent       = "ShieldingGeo5"
s:Ge/DryAirCylinder5/Material     = "G4_AIR"
d:Ge/DryAirCylinder5/RMin         = 0. mm
d:Ge/DryAirCylinder5/RMax         = 0.33 mm
d:Ge/DryAirCylinder5/SPhi         = 0. deg
d:Ge/DryAirCylinder5/DPhi         = 360. deg
d:Ge/DryAirCylinder5/HL           = 1.875 mm
d:Ge/DryAirCylinder5/TransX       = 0. mm
d:Ge/DryAirCylinder5/TransY       = 0. mm
d:Ge/DryAirCylinder5/TransZ       = 0. mm
d:Ge/DryAirCylinder5/RotX         = 0. deg
d:Ge/DryAirCylinder5/RotY         = 0. deg
d:Ge/DryAirCylinder5/RotZ         = 0. deg
s:Ge/DryAirCylinder5/DrawingStyle = "FullWireFrame"
s:Ge/DryAirCylinder5/Color        = "white"
b:Ge/DryAirCylinder5/IsParallel   = "T"
s:Ge/DryAirCylinder5/ParallelWorldName = "ShieldingWorld"



